// Created by Charles on 2020/7/27--15:47.
<template>
    <div>
        <v-dialog
            title="税率方案查看"
            :show.sync="dialogVisible"
            @beforeClose="beforeClose"
            width="1200px">
            <div class="data-info">
                <div class="info-list mb20">

                    <dl>
                        <dt>税率类型</dt>
                        <dd>{{data.taxesName}}</dd>
                    </dl>
                    <dl v-if="data.taxesName != '城镇土地使用税'">
                        <dt>税率</dt>
                        <dd>{{data.taxes}}</dd>
                    </dl>

                    <dl>
                        <dt>税率更新时间</dt>
                        <dd v>{{data.updateTime}}</dd>
                    </dl>
                    <dl>
                        <dt>计算公式</dt>
                        <dd>{{data.formula}}</dd>
                    </dl>
                    <dl>
                        <dt>税率适用时间范围</dt>
                        <dd>{{data.startTime}}至{{data.endTime}}</dd>
                    </dl>
                    <dl>
                        <dt>备注</dt>
                        <dd>{{data.remarks}}</dd>
                    </dl>
                </div>

                <el-table v-if="data.taxesName === '城镇土地使用税'" :data="taxesApplyArr" class="full"
                          align="center"  @selection-change="selectionChange">
                    <el-table-column  label="税级" align="">
                            税额
                    </el-table-column>
                    <el-table-column  label="1"  prop="taxesApply1">
                        {{taxesApplyArr[0].taxesApply1}}
                    </el-table-column>
                    <el-table-column label="2" prop="taxesApply2">
                        {{taxesApplyArr[0].taxesApply2}}
                    </el-table-column>
                    <el-table-column label="3" prop="taxesApply3">
                        {{taxesApplyArr[0].taxesApply3}}
                    </el-table-column>
                    <el-table-column label="4" prop="taxesApply4">
                        {{taxesApplyArr[0].taxesApply4}}
                    </el-table-column>
                    <el-table-column label="5" prop="taxesApply5">
                        {{taxesApplyArr[0].taxesApply5}}
                    </el-table-column>
                </el-table>

            </div>
            <span slot="foot">
            <el-button @click="dialogVisible = false">取 消</el-button>
          </span>
        </v-dialog>
    </div>
</template>

<script>
    import {getObj} from '../../../api/finance-manage-taxes'
    import {mapState} from 'vuex'

    export default {
        data() {
            return {
                data: {},
                tableData: [
                ],
                taxesApplyArr: [{
                    taxesApply1: '',
                    taxesApply2: '',
                    taxesApply3: '',
                    taxesApply4: '',
                    taxesApply5: ''
                }],
                dialogVisible: false
            }
        },
        methods: {
            show(item) {
                console.log(item)
                getObj(item.taxesId).then(resp => {
                    this.dialogVisible = true
                    this.data = resp.data.data
                    if(this.data.taxesName === '城镇土地使用税'){
                        let arr = this.data.taxes.split(',')
                        this.taxesApplyArr[0].taxesApply1 = arr[0]
                        this.taxesApplyArr[0].taxesApply2 = arr[1]
                        this.taxesApplyArr[0].taxesApply3 = arr[2]
                        this.taxesApplyArr[0].taxesApply4 = arr[3]
                        this.taxesApplyArr[0].taxesApply5 = arr[4]
                    }

                })
            },
            selectionChange(val) {
                this.selectDataArr = val
            },
            // hxf-0916-弹框X关闭
            beforeClose(done) {
                done()
            }
        }
    }
</script>

<style lang='scss' scoped>


    @include data-title();
    @include info-list();
</style>
